Optimal. Leaf size=204 \[ \frac {1}{2} a \left (6 A b^2+6 a b B+a^2 (A+2 C)\right ) x+\frac {b \left (2 A b^2+6 a b B+6 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {(3 A b+2 a B) (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}+\frac {A \cos (c+d x) (a+b \sec (c+d x))^3 \sin (c+d x)}{2 d}-\frac {b \left (9 a A b+4 a^2 B-2 b^2 B-6 a b C\right ) \tan (c+d x)}{2 d}-\frac {b^2 (4 A b+2 a B-b C) \sec (c+d x) \tan (c+d x)}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.32, antiderivative size = 204, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 5, integrand size = 41, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.122, Rules used = {4179, 4133,
3855, 3852, 8} \begin {gather*} -\frac {b \tan (c+d x) \left (4 a^2 B+9 a A b-6 a b C-2 b^2 B\right )}{2 d}+\frac {b \left (6 a^2 C+6 a b B+2 A b^2+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {1}{2} a x \left (a^2 (A+2 C)+6 a b B+6 A b^2\right )-\frac {b^2 \tan (c+d x) \sec (c+d x) (2 a B+4 A b-b C)}{2 d}+\frac {(2 a B+3 A b) \sin (c+d x) (a+b \sec (c+d x))^2}{2 d}+\frac {A \sin (c+d x) \cos (c+d x) (a+b \sec (c+d x))^3}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 4133
Rule 4179
Rubi steps
\begin {align*} \int \cos ^2(c+d x) (a+b \sec (c+d x))^3 \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx &=\frac {A \cos (c+d x) (a+b \sec (c+d x))^3 \sin (c+d x)}{2 d}+\frac {1}{2} \int \cos (c+d x) (a+b \sec (c+d x))^2 \left (3 A b+2 a B+(2 b B+a (A+2 C)) \sec (c+d x)-2 b (A-C) \sec ^2(c+d x)\right ) \, dx\\ &=\frac {(3 A b+2 a B) (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}+\frac {A \cos (c+d x) (a+b \sec (c+d x))^3 \sin (c+d x)}{2 d}+\frac {1}{2} \int (a+b \sec (c+d x)) \left (6 A b^2+6 a b B+a^2 (A+2 C)-b (a A-2 b B-4 a C) \sec (c+d x)-2 b (4 A b+2 a B-b C) \sec ^2(c+d x)\right ) \, dx\\ &=\frac {(3 A b+2 a B) (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}+\frac {A \cos (c+d x) (a+b \sec (c+d x))^3 \sin (c+d x)}{2 d}-\frac {b^2 (4 A b+2 a B-b C) \sec (c+d x) \tan (c+d x)}{2 d}+\frac {1}{4} \int \left (2 a \left (6 A b^2+6 a b B+a^2 (A+2 C)\right )+2 b \left (2 A b^2+6 a b B+6 a^2 C+b^2 C\right ) \sec (c+d x)-2 b \left (9 a A b+4 a^2 B-2 b^2 B-6 a b C\right ) \sec ^2(c+d x)\right ) \, dx\\ &=\frac {1}{2} a \left (6 A b^2+6 a b B+a^2 (A+2 C)\right ) x+\frac {(3 A b+2 a B) (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}+\frac {A \cos (c+d x) (a+b \sec (c+d x))^3 \sin (c+d x)}{2 d}-\frac {b^2 (4 A b+2 a B-b C) \sec (c+d x) \tan (c+d x)}{2 d}-\frac {1}{2} \left (b \left (9 a A b+4 a^2 B-2 b^2 B-6 a b C\right )\right ) \int \sec ^2(c+d x) \, dx+\frac {1}{2} \left (b \left (2 A b^2+6 a b B+6 a^2 C+b^2 C\right )\right ) \int \sec (c+d x) \, dx\\ &=\frac {1}{2} a \left (6 A b^2+6 a b B+a^2 (A+2 C)\right ) x+\frac {b \left (2 A b^2+6 a b B+6 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {(3 A b+2 a B) (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}+\frac {A \cos (c+d x) (a+b \sec (c+d x))^3 \sin (c+d x)}{2 d}-\frac {b^2 (4 A b+2 a B-b C) \sec (c+d x) \tan (c+d x)}{2 d}+\frac {\left (b \left (9 a A b+4 a^2 B-2 b^2 B-6 a b C\right )\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{2 d}\\ &=\frac {1}{2} a \left (6 A b^2+6 a b B+a^2 (A+2 C)\right ) x+\frac {b \left (2 A b^2+6 a b B+6 a^2 C+b^2 C\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {(3 A b+2 a B) (a+b \sec (c+d x))^2 \sin (c+d x)}{2 d}+\frac {A \cos (c+d x) (a+b \sec (c+d x))^3 \sin (c+d x)}{2 d}-\frac {b \left (9 a A b+4 a^2 B-2 b^2 B-6 a b C\right ) \tan (c+d x)}{2 d}-\frac {b^2 (4 A b+2 a B-b C) \sec (c+d x) \tan (c+d x)}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 2.92, size = 320, normalized size = 1.57 \begin {gather*} \frac {2 a \left (6 A b^2+6 a b B+a^2 (A+2 C)\right ) (c+d x)-2 b \left (2 A b^2+6 a b B+6 a^2 C+b^2 C\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+2 b \left (2 A b^2+6 a b B+6 a^2 C+b^2 C\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {b^3 C}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 b^2 (b B+3 a C) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )}-\frac {b^3 C}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 b^2 (b B+3 a C) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )}+4 a^2 (3 A b+a B) \sin (c+d x)+a^3 A \sin (2 (c+d x))}{4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.13, size = 212, normalized size = 1.04 Too large to display
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 243, normalized size = 1.19 \begin {gather*} \frac {{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a^{3} + 4 \, {\left (d x + c\right )} C a^{3} + 12 \, {\left (d x + c\right )} B a^{2} b + 12 \, {\left (d x + c\right )} A a b^{2} - C b^{3} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 6 \, C a^{2} b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 6 \, B a b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 2 \, A b^{3} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a^{3} \sin \left (d x + c\right ) + 12 \, A a^{2} b \sin \left (d x + c\right ) + 12 \, C a b^{2} \tan \left (d x + c\right ) + 4 \, B b^{3} \tan \left (d x + c\right )}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 3.04, size = 208, normalized size = 1.02 \begin {gather*} \frac {2 \, {\left ({\left (A + 2 \, C\right )} a^{3} + 6 \, B a^{2} b + 6 \, A a b^{2}\right )} d x \cos \left (d x + c\right )^{2} + {\left (6 \, C a^{2} b + 6 \, B a b^{2} + {\left (2 \, A + C\right )} b^{3}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (6 \, C a^{2} b + 6 \, B a b^{2} + {\left (2 \, A + C\right )} b^{3}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (A a^{3} \cos \left (d x + c\right )^{3} + C b^{3} + 2 \, {\left (B a^{3} + 3 \, A a^{2} b\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (3 \, C a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 540 vs.
\(2 (192) = 384\).
time = 0.55, size = 540, normalized size = 2.65 \begin {gather*} \frac {{\left (A a^{3} + 2 \, C a^{3} + 6 \, B a^{2} b + 6 \, A a b^{2}\right )} {\left (d x + c\right )} + {\left (6 \, C a^{2} b + 6 \, B a b^{2} + 2 \, A b^{3} + C b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (6 \, C a^{2} b + 6 \, B a b^{2} + 2 \, A b^{3} + C b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 2 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 6 \, A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 6 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 2 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 3 \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 2 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 2 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 3 \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 6 \, A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 6 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 3 \, C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 6 \, A a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 6 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} - 1\right )}^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 7.20, size = 2500, normalized size = 12.25 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________